﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GuestbookList.aspx.cs" Inherits="weikebuluo.wxgzpt.Customer.GuestBook.GuestbookList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="IdeaSoft软件" name="Keywords">
	<meta content="IdeaSoft软件二维码" name="Description">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css" />
    <link href="../../../css/Bootstrap/chosen.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css" />
        <link href="/css/Bootstrap/official.css" rel="stylesheet"type="text/css" />

    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js"></script>
    <script src="../../../Scripts/zeroclipboard.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/Scripts/Inside.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.Chosen.min.js"></script>

<title>IdeaSoft软件</title>
</head>
<body>
	    <div id="main">
        <div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">

                    <div class="box">
                        <div class="box-title">
                            <div class="span6">
                                <h3><i class="icon-edit"></i>留言管理</h3>
                            </div>

                        </div>

                        <div class="box-content nozypadding">
                            <div class="row-fluid">
                                <div class="span8 control-group">
                                    <a class="btn" href="javascript:location.reload()"><i class="icon-refresh"></i>刷新</a>

                                </div>
                            </div>

                            <div class="row-fluid dataTables_wrapper">
                                    <table id="listTable" class="table table-hover table-nomargin table-bordered usertable dataTable">
                                        
										
                                    </table>
                                    <div class="dataTables_paginate paging_full_numbers">
                                        <span id="lb_page"></span>
                                    </div>
									<div class="dataTables_paginate paging_full_numbers"><span>       </span></div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

   </div>

    </div>
    </body>
</html>
<script type="text/javascript">
    var url = "GuestbookList.aspx";
    var page = 1;
    $(function () {
        GetList();
    })
    function GetList() {
        $.ajax({
            url: url + "?action=bindGuestbookList",
            type: "post",
            data: { page: page },
            success: function (msg) {
                var str = '<thead><tr><th>用户名</th><th>用户Openid</th><th>留言内容</th><th>时间</th>';
                str += '<th>操作</th></tr></thead>';
                if (msg.replace("[]", "").length > 0) {
                    msg = eval("(" + msg + ")");
                    var total = msg.total;
                    var rows = msg.rows;
                    $(rows).each(function (i) {
                        str += '<tr><td>' + rows[i].Guestbook_Name + '</td><td>' + rows[i].Guestbook_WeChatID + '</td>';

                        if (rows[i].Guestbook_Father == 0) {
                            str += '<td>' + rows[i].Guestbook_Content + '</td>';
                        } else {
                            str += '<td><strong>回复内容：</strong>' + rows[i].Guestbook_Content + '</td>';
                        }

                        str += '<td><span class="label label-satgreen">' + rows[i].Guestbook_Time + '</span></td>';
                        str += '<td><a href="javascript:InBlackList(\'' + rows[i].Guestbook_WeChatID + '\')" class="btn">会员拖入黑名单</a>';

                        if (rows[i].Guestbook_Stutas == "2") {
                            str += '<a class="btn" onClick="GetAudit(' + rows[i].Guestbook_ID + ')"><span class="label label-lightred">未审核</span></a>';
                        }
                        else {
                            if (rows[i].Guestbook_Stutas == "1") {
                                str += '<a id="Audit_' + rows[i].Guestbook_ID + '" class="btn" onClick="GetAudit(' + rows[i].Guestbook_ID + ')"><span class="label label-satgreen">已通过</span></a>';
                            }
                            else if (rows[i].Guestbook_Stutas == "0") {
                                str += '<a id="Audit_' + rows[i].Guestbook_ID + '" class="btn" onClick="GetAudit(' + rows[i].Guestbook_ID + ')"><span class="label">未通过</span></a>';
                            }
                        }

                        str += '<a href="javascript:Delete(' + rows[i].Guestbook_ID + ')" class="btn">删除</a></td><tr>';
                    });
                    if (parseInt(total) > (15 * parseInt(page))) {
                        $("#lb_page").html('<a href="#" onClick="GetPage(' + (parseInt(page) + 1) + ')">下一页</a>');
                    } else {
                        $("#lb_page").html('');
                    }
                    if (parseInt(page) > 1) {
                        $("#lb_page").html('<a href="#" onClick="GetPage(' + (parseInt(page) - 1) + ')">上一页</a>' + $("#lb_page").html());
                    }
                }
                $("#listTable").html(str + "</tbady>");
            }
        });
    }
    function GetAudit(id) {
        G.ui.tips.confirm_audit("是否通过审核", function () {
            $.ajax({
                url: url + "?action=Audit",
                type: "post",
                data: { id: id, Audit: "0" },
                success: function (msg) {
                    if (msg == "True") {
                        GetList();
                        $.fallr('hide');
                    }
                }
            });
        }, function () {
            $.ajax({
                url: url + "?action=Audit",
                type: "post",
                data: { id: id, Audit: "1" },
                success: function (msg) {
                    if (msg == "True") {
                        GetList();
                        $.fallr('hide');
                    }
                }
            });
        })
    }
    function GetPage(p) {
        page = p;
        GetList();
    }
    function Delete(Id) {
        G.ui.tips.confirm("确定要删除？", "GuestbookList.aspx?action=del&Id=" + Id);
    }
    function InBlackList(Guestbook_WeChatID) {
        G.ui.tips.confirm("确定要将此会员拖入黑名单？", "GuestbookList.aspx?action=blacklist&Guestbook_WeChatID=" + Guestbook_WeChatID);
    }

</script>